<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head th:include="include :: header"></head>
<body class="hold-transition skin-blue sidebar-mini">
<section class="content-header">
    <h1>铆焊工时审核</h1>
</section>
<section class="content">
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header">
                    <form id="queryForm">
                        <div class="row">
                            <input type="hidden" name="reportType" value="1">
                            <input type="hidden" name="inputKind" value="0" >
                            <div class="form-inline">
                                <div class="form-group" style="padding-bottom:4px">
                                    <label class="control-label" style="text-align: right">项目编号</label>
                                    <label class="form-control" style="width: 120px" th:text="${project.fkCode}"></label>
                                    <input name="code" th:value="${project.fkCode}" type = "hidden" style="display: nove" />
                                </div>
                                <div class="form-group" style="padding-bottom:4px">
                                    <label class="control-label">项目名称</label>
                                    <label class="form-control" style="width: 240px" th:text="${project.name}"></label>
                                </div>
                                <div class="form-group" style="padding-bottom:4px">
                                    <label class="control-label">项目数量</label>
                                    <label class="form-control" style="width: 80px" th:text="${project.num}"></label>
                                </div>
                                <div class="form-group" style="padding-bottom:4px">
                                    <label class="control-label">设计专业</label>
                                    <label class="form-control" style="width: 80px" th:text="${project.specialId}"></label>
                                    <input name="specialId" th:value="${project.specialId}" type = "hidden" style="display: nove" />
                                </div>
                                <div class="form-group" style="padding-bottom:4px">
                                    <label class="control-label">设备部分</label>
                                    <label class="form-control" style="width: 150px" th:text="${project.partName}"></label>
                                    <input name="partName" th:value="${project.partName}" type = "hidden" style="display: nove" />
                                </div>
                                <div id="toolbar" class="form-group" >
                                    <a href="javascript:void(0);"
                                       class="btn btn-success"
                                       onclick="solderingPass()">
                                        <span class="Bold">审核通过</span>
                                    </a>
                                    <a href="javascript:void(0);"
                                       class="btn btn-warning"
                                       onclick="solderingRejec()">
                                        <span class="Bold">数据驳回</span>
                                    </a>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table1"
                           style="table-layout: fixed;word-break:break-all; word-wrap:break-word;"></table>
                </div>
                <div class="box-body">
                    <table id="bootstrap-table2"
                           style="table-layout: fixed;word-break:break-all; word-wrap:break-word;"></table>
                </div>
            </div>
        </div>
    </div>
</section>

<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var table1;
    var table2;
    $(function () {
        //加载列表数据,
        // 工时类别
        table1 = js.table.init({
            id: 'bootstrap-table1',
            url: ctx + "est/dataEntry/solderingCheck/manpower",
            toolbar: 'toolbar1',
            showColumns: false,
            showExport: false,
            pagination: false,
            pageSize: 3,
            striped: false,
            columns: [
                {
                    title: '序号', field: 'invId', width: '60',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: '铆焊工时类别', field: 'manHours', width: '300'},
                {title: '数量', field: 'manNum', width: '120'},
                {title: '单位', field: 'manUnit', width: '120'},
                {title: '备注', field: 'manRemark', width: '300'},
                {title: '填报人', field: 'manInputUser', width: '120'},
                {title: '填报时间', field: 'manEditDate', width: '120'},
            ]
        });
        /**
         * 表格搜索
         */
        $("#btn-search").on('click', function () {
            js.table.search(table1);
        });
        //加载列表数据,辅材列表
        table2 = js.table.init({
            id: 'bootstrap-table2',
            url: ctx + "est/dataEntry/solderingCheck/material",
            toolbar: 'toolbar2',
            showColumns: false,
            showExport: false,
            pagination: false,
            pageSize: 3,
            striped: false,
            columns: [
                {
                    title: '序号', field: 'invId', width: '60',
                    formatter: function (value, row, index) {
                        return index + 1;
                    }
                },
                {title: '主要辅材类别', field: 'matName', width: '300'},
                {title: '辅材用量', field: 'matNum', width: '120'},
                {title: '单位', field: 'matUnit', width: '120'},
                {title: '备注', field: 'matRemark', width: '300'},
                {title: '填报人', field: 'matInputUser', width: '120'},
                {title: '填报时间', field: 'matEditDate', width: '120'},
            ]
        });
        /**
         * 表格搜索
         */
        $("#btn-search").on('click', function () {
            js.table.search(table2);
        });

    });
    function solderingPass() {

        js.modal.confirm("您确定审核通过这些铆焊工时数据吗？", function () {
            js.submit({
                data: new FormData($("#sheetForm")[0]),
                url: ctx + 'est/dataEntry/solderingCheck/solderingVerify',
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table1);
                        js.table.refresh(table2);
                    } else {
                        js.modal.warning(result.msg);
                    }
                    js.modal.closeLoading();
                }
            });
        });
    }
    function solderingRejec() {

        js.modal.confirm("您确定驳回这些铆焊工时数据吗？", function () {
            js.submit({
                data: new FormData($("#sheetForm")[0]),
                url: ctx + 'est/dataEntry/solderingCheck/solderingVerify',
                success: function (result) {
                    if (result.type === web_status.SUCCESS) {
                        js.modal.success(result.msg);
                        js.table.refresh(table1);
                        js.table.refresh(table2);
                    } else {
                        js.modal.warning(result.msg);
                    }
                    js.modal.closeLoading();
                }
            });
        });
    }
</script>
</body>
</html>